﻿@using Helena.Areas.Clientes.Models
@using Helena.Models
@model IEnumerable<ClienteView>
@using Telerik.Web.Mvc.UI

@{
    ViewBag.Title = "Clientes";
    Layout = "~/Views/Shared/_Layout.cshtml";     
}
<style type="text/css">
    .t-window
    {
        width: 500px;
        margin: 0px auto;
    }
</style>
<div class="block big" style="position: relative">
    <!-- Block Begin -->
    <div class="titlebar">
        <h3>
            Administración de Clientes
        </h3>
    </div>
        <div class="block_cont">
        @(Html.Telerik().Grid(Model)
        .Name("ClienteGrid")
        .Localizable("es-ES")
        .Filterable()
        .DataKeys(key => key.Add(c => c.ID))
        .ToolBar(commands => commands.Insert())
        .Editable(editing => editing
                        .Mode(GridEditMode.PopUp)
                        .TemplateName("ClienteViewTemplate")
        )
        .Columns(columns =>
        {       
            columns.Bound(c=>c.RazonSocial);
            columns.Bound(c=>c.Ruc_Dni);
            columns.Bound(c => c.Telefono);
            columns.Bound(c => c.Direccion);
            columns.Bound(c=>c.Estado)
                .ClientTemplate("<input type='checkbox' disabled='disabled' name='Estado' <#= Estado? checked='checked' : '' #> />");              
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Image);
            }).Title("Editar");
        })
        .Pageable()
        .Sortable()
        .PrefixUrlParameters(false)

        .DataBinding(dataBinding => dataBinding
            .Ajax()
            .Select("Select", "Cliente")
            .Insert("Insert", "Cliente")
            .Delete("Delete", "Cliente")
            .Update("Update", "Cliente")
        )
                   )

    </div>
    <!-- Table Wrapper End -->
</div>